/**
 * @author cuichao
 * 权限管理
 */
import request from '@/utils/request'

export function getRoutes() {
  return request({
    url: '/vue-element-admin/routes',
    method: 'get'
  })
}

/**
 * 根据角色Id获取Role信息
 * @param query
 */
export function getRole(roleId) {
  return request({
    url: `/acl/role/${roleId}`,
    method: 'get'
  })
}

export function getRoles(query) {
  return request({
    url: '/acl/roles',
    method: 'get',
    params: { ...query }
  })
}

export function addRole(data) {
  return request({
    url: '/acl/addRole',
    method: 'post',
    data
  })
}

export function updateRole(data) {
  return request({
    url: '/acl/editRole',
    method: 'post',
    data
  })
}

export function deleteRole(id) {
  return request({
    url: `/acl/removeRole/${id}`,
    method: 'get'
  })
}

export function getPermissionTree() {
  return request({
    url: '/acl/fold1',
    method: 'get'
  })
}
